﻿using System;
using System.Runtime.InteropServices;

namespace Vtron.LEDCorrective.Domain.LEDSender
{
    /// <summary>
    /// SCP协议数据头
    /// </summary>
    /// <remarks>
    //  协议头部
    //  struct _scp_header_t
    //  {
    //      u_int32_t			scp_id;		/*会话ID，由控制软件创建*/
    //      u_int16_t			scp_type;		/*对应EnumScpType，这里占用2个字节，是为了兼容之前的协议*/
    //      u_int32_t			scp_datalen;
    //      int8_t			scp_data[0];
    //  }PACKED;
    //  typedef struct _scp_header_t	
    /// </remarks>
    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 210)]
        public byte[] scp_data;
    }
}
